﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XfTech.SmartTms.Data;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using XfTech.SmartTms.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using XfTech.SmartTms.Entities;
using Microsoft.EntityFrameworkCore;
using JetBrains.Annotations;

namespace XfTech.SmartTms.Repositories
{
    /// <summary>
    /// 实现车辆模块 根聚合仓储类型
    /// </summary>
    public class VehicleRepository : EfCoreRepository<SmartTmsDbContext, Vehicle, Guid>, IVehicleRepository
    {
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="contextProvider"></param>
        public VehicleRepository(IDbContextProvider<SmartTmsDbContext> contextProvider)
            : base(contextProvider)
        {
        }

        //以下可以写自己的仓储方法

        /// <summary>
        /// 根据品牌查询车辆信息
        /// </summary>
        /// <param name="brand"></param>
        /// <returns></returns>
        public async Task<List<Vehicle>> GetListByBrand([NotNull] string brand)
        {
            return await DbContext.Set<Vehicle>()
                                  .Where(x => x.Brand.Equals(brand))
                                  .ToListAsync();
        }



    }
}
